package com.leyou.item.inter.api;

import com.leyou.common.bean.Result;
import com.leyou.common.bean.ServerConstant;
import com.leyou.item.inter.fallback.CategoryServiceFallbackFactory;
import com.leyou.item.inter.pojo.Category;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zqq
 * @ClassName ICategoryService
 * @Description
 * @date 2020/3/4-10:06
 */
@Component
@FeignClient(value = ServerConstant.ITEM_SERVICE_ID, fallbackFactory = CategoryServiceFallbackFactory.class)
public interface ICategoryService {

    @RequestMapping(value = "/category/list/{pid}", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<List<Category>> queryCategoriesByPid(@PathVariable(value = "pid") Long pid);

    @RequestMapping(value = "/category/bid/{bid}", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<List<Category>> queryByBrandId(@PathVariable("bid") Long bid);

    @RequestMapping(value = "/category/names", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<List<String>> queryNamesByIds(@RequestBody @RequestParam("ids")List<Long> ids);

    @RequestMapping(value = "/category/cid/{id}", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<Category> queryCategoryById(@PathVariable("id") Long id);

}
